home *** CD-ROM | disk | FTP | other *** search
- -- background: 2079 from stack: in
- -- bmap block id: 3335
- -- flags: 4000
- -- background id: 0
- -- name: Title
- ----- HyperTalk script -----
- on openBackground
- push recent card
- end openBackground
-
-
- -- part 1 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=29 top=297 right=319 bottom=147
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Import Fortunes
- ----- HyperTalk script -----
- on mouseUp
- set the cursor to 4
- go to first card
- doMenu "Copy Card"
- go to last card
- doMenu "Paste Card"
- -- unlock the following fields so we can change them
- set lockText of field "Your Fortune" to false
- set lockText of field "Category" to false
- go to card "Control Card"
- repeat with i = 1 to the number of lines in field "Files to Import"
- get line i of field "Files to Import"
- put it into category
- get line 1 of field "Search Path"
- put it & category into fileName
- open file fileName
- read from file fileName for 1 -- get the delimiter character
- put it into delimiter
- read from file fileName until return -- and skip rest of line
- read from file fileName until delimiter
- push card
- go to last card
- repeat until it is empty
- put empty into last char of it -- don't include the delimiter
- put it into field "Your Fortune"
- put category into field "Category"
- doMenu "New Card"
- read from file fileName until return -- and skip rest of line
- read from file fileName until delimiter
- end repeat
- close file fileName
- pop card
- end repeat
- go to last card -- which is blank
- doMenu "Delete Card"
- -- Re-lock fields
- set lockText of field "Your Fortune" of card "Sample Card" to true
- set lockText of field "Category" of card "Sample Card" to true
- end mouseUp
-
-
-
- -- part 2 (field)
- -- low flags: 00
- -- high flags: 0007
- -- rect: left=25 top=182 right=279 bottom=472
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Files to Import
-
-
- -- part 3 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=25 top=138 right=157 bottom=472
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Search Path
-
-
- -- part 4 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=188 top=297 right=319 bottom=306
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Export Fortunes
- ----- HyperTalk script -----
- on mouseUp
- -- Initialize some variables
- set the cursor to 4
- put "Exporting fortunes" into field "Import/Export Status"
- show field "Import/Export Status"
- put number of card "Control Card" into firstCard
- add 1 to firstCard
- put empty into category
- put empty into fileName
- put field "Search Path" into searchPath
- put char 1 of field "Delimiter Char" & return into delimiter
- -- Now go through stack and write fortunes to their respective files
- repeat with i = firstCard to the number of cards
- put field "Category" of card i into newCategory
- if newCategory <> category then
- if fileName <> empty then close file fileName
- put newCategory into category
- put searchPath & category into filename
- open file fileName
- put "Exporting " & category & return & "Fortunes exported: 0" into field "Import/Export Status"
- write delimiter to file fileName -- We have to start with delimiter
- end if
- write field "Your fortune" of card i to file fileName
- write delimiter to file fileName
- add 1 to last word of field "Import/Export Status"
- end repeat
- close file fileName -- Close last file opened
- hide field "Import/Export Status"
- end mouseUp
-
-
-
- -- part 7 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=453 top=163 right=181 bottom=472
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Delimiter Char
-
-
- -- part 8 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=342 top=297 right=319 bottom=468
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Clear All Fortunes
- ----- HyperTalk script -----
- on mouseUp
- put number of card "Control Card" into firstCard
- add 1 to firstCard
- repeat while number of cards >= firstCard -- just keep the example card
- go to card firstCard
- doMenu "Delete Card"
- end repeat
- end mouseUp
-
-
-
- -- part 9 (button)
- -- low flags: 00
- -- high flags: 8005
- -- rect: left=25 top=85 right=107 bottom=203
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Show categories?
- ----- HyperTalk script -----
- on mouseUp
- get hilite of me
- set hilite of me to not it
- if hilite of me then
- show field "Category" of card "Sample Card"
- else
- hide field "Category" of card "Sample Card"
- end if
- end mouseUp
-
-
-
- -- part 11 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=7 top=25 right=47 bottom=43
- -- title width / last selected line: 0
- -- icon id / first selected line: 1011 / 1011
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Home
- ----- HyperTalk script -----
- on mouseUp
- go to home
- end mouseUp
-
-
-
- -- part 12 (field)
- -- low flags: 80
- -- high flags: 0004
- -- rect: left=90 top=192 right=233 bottom=416
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Import/Export Status
-